import request from '@/utils/request'

// 查询供应商信息列表
export function listSupplier(query) {
  return request({
    url: '/member/supplier/list',
    method: 'post',
    data: query
  })
}

// 查询供应商信息详细
export function getSupplier(id) {
  return request({
    url: '/member/supplier/' + id,
    method: 'get'
  })
}

// 查询供应商信息详细
export function getSupplierById(id) {
  return request({
    url: '/member/supplier/getSupplierById/' + id,
    method: 'get'
  })
}

// 查询供应商附加信息详细
export function getSupplierAttach(id) {
  return request({
    url: '/member/supplierAttach/' + id,
    method: 'get'
  })
}

// 查询供应商企业附加信息
export function getEnterpriseAttach(id) {
  return request({
    url: '/member/enterpriseAttach/' + id,
    method: 'get'
  })
}

// 新增供应商信息(v2)
export function addSupplierNew(data) {
  return request({
    url: '/member/supplier/addNew',
    method: 'post',
    data: data
  })
}

// 修改供应商信息(v2)
export function updateSupplierNew(data) {
  return request({
    url: '/member/supplier/updateNew',
    method: 'post',
    data: data
  })
}

// 新增供应商信息
export function addSupplier(data) {
  return request({
    url: '/member/supplier/add',
    method: 'post',
    data: data
  })
}

// 修改供应商信息
export function updateSupplier(data) {
  return request({
    url: '/member/supplier/update',
    method: 'post',
    data: data
  })
}

// 删除供应商信息
export function delSupplier(id) {
  return request({
    url: '/member/supplier/delete/' + id,
    method: 'post'
  })
}

//设置供应商为客户
export function setCustomer(id){
  return request({
    url: '/member/supplier/setCustomer/' + id,
    method: 'post'
  })
}
//设置供应商结算日期
export function updateSettleDate(data){
  return request({
    url: '/member/supplier/updateSettleDate',
    method: 'post',
    data: data
  })
}
// 查询供应商结算信息列表
export function listSettleSupplier(query) {
  return request({
    url: '/member/supplier/listSettle',
    method: 'post',
    data: query
  })
}

export function preAudit(id){
  return request({
    url: '/member/supplier/preAudit/' + id,
    method: 'post'
  })
}

export function preAuditCancel(id){
  return request({
    url: '/member/supplier/preAuditCancel/' + id,
    method: 'post'
  })
}

export function reAudit(id){
  return request({
    url: '/member/supplier/reAudit/' + id,
    method: 'post'
  })
}

export function reAuditCancel(id){
  return request({
    url: '/member/supplier/reAuditCancel/' + id,
    method: 'post'
  })
}
